1. Field of the Invention
The present invention relates generally to transcoders for converting or transcoding a first signal stream compressed by a first coding scheme to a second signal stream compressed by a second coding scheme. The subject invention is particularly suitable for transcoding compressed digital video streams such as MPEG video streams.
2. Discussion of the Prior Art
FIG. 1 is a diagram of a conventional prior art Virtual Buffer Verifier wherein a compressed bit stream from a storage device or transmission channel at 100 is input to a decoder buffer 101 which is connected over a communication link 102 to a decoder 103, the output of which at 104 is displayed at 105.
FIG. 2 is an overview of a conventional prior art video compression system wherein an input video stream Fk at 200 is directed as a first input to a picture coder 205 and as an input to a complexity estimator 201. The complexity estimator output estimate Ck at 202 is input to a picture bit allocator 203 whose output Qk at 205 produces a second input to the picture coder 205. The picture coder 205 operates on the input Fk at 200, under control of the number of bits allocated as indicated by the output Qk, to produce a coded output CDk at 206.
Digital video compression techniques are widely used in many applications to reduce the storage and transmission bandwidth requirements. The dominant digital video compression techniques are specified by the international standards MPEG-1 (ISO/IEC 11718-2), MPEG-2 (ISO/IEC 13818-2) and MPEG-4 YOR920030214US1 developed by the Moving Picture Experts Group (MPEG), part of a joint technical committee of the International Standards Organization (ISO) and the International Electrotechnical Commission (IEC). These standards were developed for coding of motion pictures and associated audio signals for a wide range of applications involving the transmission and storage of compressed digital video, including video streaming, video distribution on demand, high-quality digital television transmission via coaxial networks, fiber-optic networks, terrestrial broadcast or direct satellite broadcast; and in interactive multimedia contents stored on CD-ROM, digital tape, digital video disk, and disk drives.
The MPEG standards define the syntax of the compressed bit stream and the method of decoding, but leave considerable space for novelty and variety in the algorithm employed in the encoder. These standards specify a bit stream in which the number of bits used to represent each compressed picture is variable. The variable feature is due to the different types of picture processing, as well as the inherent variation with time of the spatio-temporal complexity of the scene being coded. This leads to the use of buffers to smooth out the fluctuations in bit rate. For a constant-bit-rate storage media or transmission channel, for example, buffering allows the bit rate of the compressed pictures to vary within limits that depend on the size of the buffers, while outputting a constant bit rate to the storage device or transmission channel.
The MPEG video standards specify a coded representation of video for transmission. The standards are designed to operate on interlaced or noninterlaced component video. Each picture has three components: luminance (Y), red color difference (CR), and blue color difference (CB). For 4:2:0 data, the CR and CB components each have half as many samples as the Y component in both horizontal and vertical directions. For 4:2:2 data, the CR and CB components each have half as many samples as the Y component in the horizontal direction but the same number of samples in the vertical direction. For 4:4:4 data, the CR and CB components each have as many samples as the Y component in both horizontal and vertical directions.
An MPEG data stream consists of a video stream and an audio stream that are packed, with system information and possibly other bit streams, into a system data stream that can be regarded as layered. Within the video layer of the MPEG data stream, the compressed data is further layered. A description of the organization of the layers will aid in understanding the present invention.
The layers pertain to the operation of the compression scheme as well as the composition of a compressed bit stream. The highest layer is the Video Sequence Layer, containing control information and parameters for the entire sequence. At the next layer, a sequence is subdivided into sets of consecutive pictures, each known as a Group of Pictures (GOP). FIG. 3 illustrates a general representation of this GOP layer, and illustrates a first GOP n and a second GOP n+1. Decoding may begin at the start of any GOP, essentially independent of the preceding GOP's. There is no limit to the number of pictures that may be in a GOP, nor do there have to be equal numbers of pictures in all GOP's.
The third or “Picture” layer is a single picture. FIG. 4 illustrates a general representation of the Picture layer, and shows a representative case wherein MPEG-2 video having a frame image with rows of 96 pixels and columns of 64 pixels is down-sampled with 2:1 ratio in both vertical and horizontal directions so that a frame image with rows of 48 pixels and columns of 32 pixels can be obtained.
The luminance component of each picture is subdivided into 16×16 regions; the color difference components are subdivided into appropriately sized blocks spatially co-situated with the 16×16 luminance regions; for 4:4:4 video, the color difference components are 16×16, for 4:2:2 video, the color difference components are 8×16, and for 4:2:0 video, the color difference components are 8×8. Taken together, these co-situated luminance region and color difference regions make up the fifth layer, known as “macroblock” (MB). Macroblocks in a picture are numbered consecutively in raster scan order.
Between the Picture and MB layers is the fourth or “Slice” layer. Each slice consists of some number of consecutive MB's. Slices need not be uniform in size within a picture or from picture to picture.
Finally, FIG. 5 illustrates that each MB consists of four 8×8 luminance blocks Y1, Y2, Y3, Y4, and 8, 4, or 2 (for 4:4:4, 4:2:2 and 4:2:0 video) chrominance blocks Cb, Cr. If the width of the luminance component in picture elements or pixels of each picture is denoted as C and the height as R (C is for columns, R is for rows), a picture is C/16 MB's wide and R/16 MB's high.
The Sequence, GOP, Picture, and Slice layers all have headers associated with them. The headers begin with byte-aligned “Start Codes” and contain information pertinent to the data contained in the corresponding layer.
A picture can be either field-structured or frame-structured. A frame-structured picture contains information to reconstruct an entire frame, i.e., two fields, of data. A field-structured picture contains information to reconstruct one field. If the width of each luminance frame (in picture elements or pixels) is denoted as C and the height as R (C is for columns, R is for rows), a frame-structured picture contains information for C×R pixels and a field-structured picture contains information for C×R/2 pixels.
A macroblock in a field-structured picture contains a 16×16 pixel segment from a single field. A macroblock in a frame-structured picture contains a 16×16 pixel segment from the frame that both fields compose; each macroblock contains a 16×8 region from each of two fields.
Each frame in an MPEG-2 sequence must consist of two coded field pictures or one coded frame picture. It is illegal, for example, to code two frames as one field-structured picture followed by one frame-structured picture followed by one field-structured picture; the legal combinations are: two frame-structured pictures, four field-structured pictures, two field-structured pictures followed by one frame-structured picture, or one frame-structured picture followed by two field-structured pictures. Therefore, while there is no frame header in the MPEG-2 syntax, conceptually one can think of a frame layer in MPEG-2. Within a GOP, three “types” of pictures can appear.
FIG. 6 illustrates an example of the three types of pictures I, P, B within a GOP. The distinguishing feature among the picture types is the compression method which is used. The first type, Intra-mode pictures or I pictures, are compressed independently of any other picture. Although there are no fixed upper bound on the distance between I pictures, it is expected that they will be interspersed frequently throughout a sequence to facilitate random access and other special modes of operation. Predictively motion-compensated pictures (P pictures) are reconstructed from the compressed data in that picture and two most recently reconstructed fields from previously displayed I or P pictures. Bidirectionally motion-compensated pictures (B pictures) are reconstructed from the compressed data in that picture plus two reconstructed fields from previously displayed I or P pictures and two reconstructed fields from I or P-pictures that will be displayed in the future. Because reconstructed I or P pictures can be used to reconstruct other pictures, they are called reference pictures.
One very useful image compression technique is transform-coding. In MPEG and several other compression standards, the discrete cosine transform (DCT) is the transform of choice. The compression of an I picture is achieved by the steps of 1) taking the DCT of blocks of pixels, 2) quantizing the DCT coefficients, and 3) Huffman coding the result. In MPEG, the DCT operation converts a block of 8×8 pixels into an 8×8 set of transform coefficients. The DCT transformation by itself is a lossless operation, which can be inverted to within the precision of the computing device and the algorithm with which it is performed.
The second step, quantization of the DCT coefficients, is the primary source of loss in the MPEG standards. Denoting the elements of the two-dimensional array of DCT coefficients by cmn, where m and n can range from 0 to 7, aside from truncation or rounding corrections, quantization is achieved by dividing each DCT coefficient cmn by wmn X QP, with wmn being a weighting factor and QP being the macroblock quantizer. Note that QP is applied to each DCT coefficient. The weighting factor wmn allows coarser quantization to be applied to the less visually significant coefficients.
There can be several sets of these weights. For example, there can be one weighting factor for I pictures and another for P and B pictures. Custom weights may be transmitted in the video sequence layer, or default values may be used. The macroblock quantizer parameter is the primary means of trading off quality vs. bit rate in MPEG-2. It is important to note that QP can vary from MB to MB within a picture. This feature, known as adaptive quantization (AQ), permits different regions of each picture to be quantized with different step-sizes, and can be used to equalize (and optimize) the visual quality over each picture and from picture to picture. Typically, for example in MPEG test models, the macroblock quantizer is computed as a product of the macroblock masking factor and the picture nominal quantizer (PNQ).
Following quantization, the DCT coefficient information for each MB is organized and coded, using a set of Huffman codes. As the details of this step are not essential to an understanding of the present invention and are generally understood in the art, no further description will be offered here.
Most video sequences exhibit a high degree of correlation between consecutive pictures. A useful method to remove this redundancy before coding a picture is motion compensation. MPEG-2 provides several tools for motion compensation (described below).
All the methods of motion compensation have the following in common. For each macroblock, one or more motion vectors are encoded in the bit stream. These motion vectors allow the decoder to reconstruct a macroblock, called the predictive macroblock. The encoder subtracts the predictive macroblock from the macroblock to be encoded to form the difference macroblock. The encoder uses tools to compress the difference macroblock that are essentially similar to the tools used to compress an intra macroblock.
The type of picture determines the methods of motion compensation that can be used. The encoder chooses from among these methods for each macroblock in the picture. A method of motion compensation is described by the macroblock mode and motion compensation mode used. There are four macroblock modes, intra (I) mode, forward (F) mode, backward (B) mode, and interpolative forward-backward (FB) mode. For I mode, no motion compensation is used. For the other macroblock modes, 16×16 (S) or 16×8 (E) motion compensation modes can be used. For F macroblock mode, dual-prime (D) motion compensation mode can also be used.
The MPEG standards can be used with both constant-bit-rate and variable-bit-rate transmission and storage media. The number of bits in each picture will be variable, due to the different types of picture processing, as well as the inherent variation with time of the spatio-temporal complexity of the scene being coded. The MPEG standards use a buffer-based rate control strategy, in the form of a Virtual Buffer Verifier (VBV), to put meaningful bounds on the variation allowed in the bit rate. As depicted in FIG. 1, the VBV is devised as a decoder buffer 101 followed by a hypothetical decoder 103, whose sole task is to place bounds on the number of bits used to code each picture so that the overall bit rate equals the target allocation and the short-term deviation from the target is bounded. The VBV can operate in either a constant-bit-rate or a variable-bit-rate mode.
In the constant-bit-rate mode, the buffer is filled at a constant bit rate with compressed data in a bit stream from the storage or transmission medium. Both the buffer size and the bit rate are parameters that are transmitted in the compressed bit stream. After an initial delay, which is also derived from information in the bit stream, the hypothetical decoder instantaneously removes from the buffer all of the data associated with the first picture. Thereafter, at intervals equal to the picture rate of the sequence, the decoder removes all data associated with the earliest picture in the buffer.
FIG. 7 illustrates an example of the operation of the VBV and depicts a graph of the fullness of the decoder buffer as a function of time. The buffer starts with an initial buffer fullness of Bi after an initial delay of time T0. The sloped line segments show the compressed data entering the buffer at a constant bit rate. The vertical line segments show the instantaneous removal from the buffer of the data associated with the earliest picture in the buffer. In this example, the pictures are shown to be removed at a constant interval of time T. In general, the picture display interval, i.e., the time interval between the removal of consecutive pictures, may be variable.
For the bit stream to satisfy the MPEG rate control requirements, it is necessary that all the data for each picture be available within the buffer at the instant it is needed by the decoder and that the decoder buffer does not overfill. These requirements translate to upper (Uk) and lower (Lk) bounds on the number of bits allowed in each picture (k). The upper and lower bounds for a given picture depend on the number of bits used in all the pictures preceding it. For example, the second picture may not contain more than U2 bits since that is the number of bits available in the buffer when the second picture is to be removed, nor less than L2 bits since removing less than L2 bits would result in the buffer overflowing with incoming bits. It is a function of the encoder to produce bit streams that can be decoded by the VBV without error.
For constant-bit-rate operation, the buffer fullness just before removing a picture from the buffer is equal to the buffer fullness just before removing the previous picture minus the number of bits in the previous picture plus the product of the bit rate and the amount of time between removing the picture and the previous picture; i.e.,buffer fullness before remove pic=buffer fullness before remove last pic−bits in last pic+time between pic and last pic×bit rate   (1)
The upper bound for the number of bits in a picture is equal to the buffer fullness just before removing that picture from the buffer. The lower bound is the greater of zero bits or the buffer size minus the buffer fullness just before removing that picture from the buffer plus the number of bits that will enter the buffer before the next picture is removed. The buffer fullness before removing a given picture depends on the initial buffer fullness and the number of bits in all of the preceding pictures, and can be calculated by using the above rules.
Variable-bit-rate operation is similar to the above, except that the compressed bit stream enters the buffer at a specified maximum bit rate until the buffer is full, when no more bits are input. This translates to a bit rate entering the buffer that may be effectively variable, up to the maximum specified rate. FIG. 8 illustrates an exemplary plot of the buffer fullness under variable-bit-rate operation as a function of time. The buffer operates similarly to the constant-bit-rate case except that the buffer fullness, by definition, cannot exceed the buffer size of Bmax. This leads to an upper bound on the number of bits produced for each picture, but no lower bound.
For variable bit rate operation, the buffer fullness just before removing a picture from the buffer is equal to the size of the buffer or to the buffer fullness just before removing the previous picture minus the number of bits in the previous picture plus the maximum bit rate times the amount of time between removing the picture and the previous picture, whichever is smaller; i.e.,buffer fullness before remove pic=min(buffer fullness before remove last pic−bits in last pic+time between pic and last pic×bit rate, buffer size)  (2)
The upper bound for the number of bits in a picture is again equal to the buffer fullness just before removing that picture from the buffer. As mentioned earlier, the lower bound is zero. The buffer fullness before removing a given picture again depends on the initial buffer fullness and the number of bits in all of the preceding pictures, and can be calculated by using the above rules.
Video transcoding is a process of converting one compressed video stream to another compressed video stream. Video transcoding techniques have been widely used in various present day multimedia applications. There are two advantages to applying transcoding techniques to internet applications such as video downloading and streaming. First, by storing a high quality compressed video stream (rather than the raw video file), a substantial amount of storage space in the server can be saved. Second, by reusing a part of the compressed video information carried in the source video stream, the transcoding process can be greatly simplified in comparison with the traditional encoding process so that it is suitable for online applications. Video transcoding among various bit rates (e.g. from DVD high quality video to wireless low quality video) has to consider the rate control issue to meet the bandwidth, buffer, and delay constraints, etc. In real-world applications, including video on demand, digital video broadcasting, distance learning, etc., a proper algorithm is implemented inside the video transcoder so that the video stream can be transcoded to fit the client's bandwidth capacity without severe quality degradation.
Generally speaking, video transcoders are classified into three types. The type 1 (T1) transcoder is the simplest transcoder. As shown in FIG. 9(a), it re-quantizes the DCT coefficients of the input bit stream by a bigger quantization step size. Consequently, the complexity of the T1 transcoder is very low. However, drift errors can occur in P and B frames and accumulate in P frames until the next I frame is transcoded. Thus, the quality of T1 is poor. In contrast, there is the type 3 (T3) transcoder, which cascades a full decoder with a full encoder as shown in FIG. 9(c). Because motions are re-estimated and residues are recalculated in the T3 transcoder, drift errors can be completely eliminated. However, this results in a very high computational complexity, and T3 is not suitable for low complexity or real-time applications. To compromise the quality and the complexity, the type 2 (T2) transcoder was proposed. It is shown in FIG. 9(b). Since the T2 transcoder recalculates residues based on the previous transcoded frame image, drift errors can be avoided and the final reconstruction error depends only on the quantization noise. Thus, T2 results in high quality transcoded video. The complexity of T2 is higher than that of T1 due to the IDCT/MCP/DCT (inverse discrete cosine transform/motion compensated picture/discrete cosine transform) operations. However, T2 is significantly less complex than T3, since it re-uses the motion information carried by the input bit stream instead of processing motion re-estimation. Hence, T2 provides a good solution to high quality and low complexity transcoding applications.
There has been some previous work proposed for T1 and T2 transcoders, while T3 transcoders can simply adopt any rate control approach designed for the traditional video encoder. Consider the transcoding of MPEG-2 video of a larger spatial resolution, e.g. 704×576 or 720×480 (4CIF or 4SIF), 352×288 (CIF) to MPEG-4 video of a lower spatial resolution, e.g. 352×288 (CIF), 176×144 (QCIF). First, the transcoder needs to down-sample the input MPEG-2 video. The motion vectors carried by the MPEG-2 stream will be reused in the transcoding process. That is, MPEG-2 motion vectors are sub-sampled, and the coding mode for each down-sampled macroblock is examined.
The previous published work on video transcoding aims at rate conversion among different bit rates, usually from high to low. The frame-level rate control schemes were recently proposed by Lie et al. {W.-N. Lie and Y.-H. Chen, “Dynamic rate control for MPEG-2 bit stream transcoding,” IEEE Proc. ICIP, 2001, vol.1 pp. 477-480} and Lu et al. {L. Lu, at el. “Efficient and low-cost video transocding,” SPIE Proc. VCIP, 2002, vol. 4671, pp. 154-163}. However, both of them tried to control the bit rate at a constant frame rate, i.e. frame skipping was not adopted.